#!/usr/bin/python
from pychartdir import *

def GerarGrafico(valor, tempo, evento):
	# The data for the line chart
	listaValor = []
	for x in valor:
		listaValor.append(x)

	# The labels for the line chart
	listaTempo = []
	for x in tempo:
		listaTempo.append(str(x))

	# Create a XYChart object of size 500 x 500 pixels
	c = XYChart(490, 300)

	# Set the plotarea at (40, 50) and of size 400 x 400 pixels
	c.setPlotArea(28, 10, 448, 260)

	# Add a line chart layer using the given data
	c.addLineLayer(listaValor)

	# Set the labels on the x axis.
	
	c.xAxis().setLabels(listaTempo)

	# Display 1 out of 3 labels on the x-axis.
	c.xAxis().setLabelStep(1)

	# Output the chart
	if evento == 1:
		c.makeChart("C:/fotometria/media/graficos/graficoTemperatura.png")
	elif evento == 2:
		c.makeChart("C:/fotometria/media/graficos/graficoUmidade.png")
	else:
		c.makeChart("C:/fotometria/media/graficos/graficoRadiacao.png")
	
def ExibirGrafico(valor, tempo, evento):
	# The data for the line chart
	listaValor = []
	for x in valor:
		listaValor.append(x)

	# The labels for the line chart
	listaTempo = []
	for x in tempo:
		listaTempo.append(str(x))

	# Create a XYChart object of size 500 x 500 pixels
	c = XYChart(490, 300)

	# Set the plotarea at (40, 50) and of size 400 x 400 pixels
	c.setPlotArea(28, 10, 448, 260)

	# Add a line chart layer using the given data
	c.addLineLayer(listaValor)

	# Set the labels on the x axis.
	
	c.xAxis().setLabels(listaTempo)

	# Display 1 out of 3 labels on the x-axis.
	c.xAxis().setLabelStep(1)

	# Output the chart
	if evento == 1:
		c.makeChart("C:/fotometria/media/graficos/ConstultaGraficotemperatura.png")
	elif evento == 2:
		c.makeChart("C:/fotometria/media/graficos/ConstultaGraficoumidade-relativa.png")
	else:
		c.makeChart("C:/fotometria/media/graficos/ConstultaGraficointensidade-de-radiacao-solar.png")


